from abc import ABCMeta,abstractmethod
class Duck(metaclass=ABCMeta):
    @abstractmethod
    def FlyBehavior(self):
        pass
# class QuackBehavior(metaclass=ABCMeta):
#     @abstractmethod
#     def BehaveQuack(self):
#         pass
class FlyBehavior(metaclass=ABCMeta):
    @abstractmethod
    def BehaveFly(self):
        pass
class FlyWithWing(FlyBehavior):
    def BehaveFly(self):
        print('can fly with wing')
class NoCanFly(FlyBehavior):
    def BehaveFly(self):
        print('can not fly')

class SimpleDuck(Duck):
    def __init__(self):
        self.__flyBehavior = FlyWithWing()
    def SetFlyBehavior(self, FlyBehavior):
        self.__flyBehavior = FlyBehavior
    def FlyBehavior(self):
        print('simple duck:')
        self.__flyBehavior.BehaveFly()
class RocketDuck(Duck):
    def __init__(self):
        self.__flyBehavior = NoCanFly()
    def SetFlyBehavior(self, FlyBehavior):
        self.__flyBehavior = FlyBehavior
    def FlyBehavior(self):
        print('rocket duck:')
        self.__flyBehavior.BehaveFly()

if __name__ == '__main__':
    simple = SimpleDuck()
    simple.FlyBehavior()
    simple.SetFlyBehavior(NoCanFly())
    simple.FlyBehavior()
    rocket = RocketDuck()
    rocket.FlyBehavior()
